﻿using University.Workshop.DataAccess;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using University.Workshop.Business;
using University.Workshop.Model;

namespace University.Workshop.Tests
{
    
    
    /// <summary>
    ///This is a test class for ViewsDataAccessTest and is intended
    ///to contain all ViewsDataAccessTest Unit Tests
    ///</summary>
    [TestClass()]
    public class ViewsDataAccessTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for InsertView
        ///</summary>
        [TestMethod()]
        public void InsertViewTest()
        {
            string firstName = "Pedro"; // TODO: Initialize to an appropriate value
            string lastName = "Suarez"; // TODO: Initialize to an appropriate value
            char gender = 'M'; // TODO: Initialize to an appropriate value
            Random rand = new Random();
            DateTime birthday = DateTime.Now.AddYears(-18); // TODO: Initialize to an appropriate value
            string email = "pedro" + rand.Next(400) + "@gmail.com"; // TODO: Initialize to an appropriate value
            string password = "qwert1"; // TODO: Initialize to an appropriate value
            string rePassword = "qwert1"; // TODO: Initialize to an appropriate value
            string department = "Cochabamba"; // TODO: Initialize to an appropriate value
            string city = "Cercado"; // TODO: Initialize to an appropriate value
            string movilephone = "" + rand.Next(79999999); // TODO: Initialize to an appropriate value
            string phone = "" + rand.Next(4999999); // TODO: Initialize to an appropriate value
            UserRegistrationManager.RegisterUser(firstName, lastName, gender, birthday, email, password, rePassword, department, city, movilephone, phone);
            Product prod = ProductRegistrationManager.RegisterNewProduct("computadoras portatiles", "5234", "fafawfwef awefwfwefawfwef afwefawefawf fasfsafsaffsf", "Electronics", false, "Dollars", 1, "1");
            string userId = "1"; // TODO: Initialize to an appropriate value
            string prodId = prod.ProductId.ToString(); // TODO: Initialize to an appropriate value
            DateTime date = DateTime.Now; // TODO: Initialize to an appropriate value
            ViewsDataAccess.InsertView(userId, prodId, date);
        }
    }
}
